<template>
  <div class="">
    <div class="page-filter mb10 fl">
      <el-form ref="filter" :model="filter" label-width="0">
        <el-form-item class="mr10 mb5 fl">
          <ProFilter v-model="filter.pro_id" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <CustomerSelect v-model="filter.ctm_id" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" style="width: 300px">
          <el-button class="fl"  size="small" @click="app.resetFields($refs['filter'].$parent,'filter')">清 空</el-button>
          <el-button class="fl" type="primary" size="small" @click="getList()">查 询</el-button>
        </el-form-item>
      </el-form>
    </div> 
    <el-table v-loading="app.loading" class="search-table" :data="list" border 
      :summary-method="getSummaries"
      show-summary
      fit highlight-current-row style="width: 100%;">
      <el-table-column label="序号" align="center" width="56px">
        <template slot-scope="{$index}">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column label="项目名称" min-width="260px" prop="pro_name" />
      <el-table-column label="客户名称" min-width="220px" prop="ctm_name" />
      <el-table-column label="回款金额" align="right" width="140px">
        <template slot-scope="{row}">
          {{ app.toFix(row.xshk_money, 2) }}
        </template>
      </el-table-column>
      <el-table-column label="计划回款金额" align="right" width="140px">
        <template slot-scope="{row}">
          {{ app.toFix(row.plan_money, 2) }}
        </template>
      </el-table-column>
      <el-table-column label="回款方式" align="center" width="110px" prop="pt_value" />
      <el-table-column label="回款时间" align="center" width="120px" prop="xshk_time" />
      <el-table-column label="计划回款时间" align="center" width="120px" prop="plan_time" />
      <el-table-column label="操作" align="center" width="90px" fixed="right">
        <template slot-scope="{row}">
          <el-dropdown>
            <el-button type="primary" size="mini">
              操作<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="handleDialog({...row, ...{dRef: 'dialog', dTitle: '项目回款收款', dType: 'edit', dField: dField}})">确 认</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="filter.pageAll>0" :total="filter.pageAll" :page.sync="filter.pageCurrent" :limit.sync="filter.pageNumber" @pagination="getList" />
    <Dialog ref="dialog" :get-data="getList" :info="dialog" />
  </div>
</template>

<script>
import page from '@/utils/page'
import Dialog from './components/proXshk-dialog'
import { proXshks } from '@/api/finance/fund'
import CustomerSelect from '@/myComponents/CustomerSelect'
import ProFilter from '@/components/ProFilter'

export default {
  name: '',
  components: { Dialog, CustomerSelect, ProFilter },
  extends: page,
  props: {
    reqList: {
      default: proXshks,
      type: Function
    }
  },
  data() {
    return {
      price: {},
      dField: ['account_id', 'xshk_money', 'xshk_id', 'collection_date', 'ctm_name']
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getListAfter(e) {
      this.price = e.summary
    },
    getSummaries() {
      const sums = []
      sums[0] = '合计'
      sums[3] = this.app.toFix(this.price.xshk_money, 2)
      sums[4] = this.app.toFix(this.price.plan_money, 2)
      return sums
    }
  }
}
</script>
<style scoped>
</style>
